<?
session_start();
if(empty($_GET['agent_id'])) {
	exit;
}
$_SESSION['kqyb_agent_id'] = $_GET['agent_id'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>康琪100客户联络中心</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="../../../webkit/utils/jquery.js"></script>
<script type="text/javascript" src="../../../webkit/grid/import.js"></script>
<script type="text/javascript" src="../../../webkit/dialog/import.js"></script>
</head>
<body bgccolor="#f4f4f4" style="margin:0px">

<table width=100% height=100% cellspacing=0 cellpadding=0>
	<tr bgcolor="white">
	<form name=f>
	<td height=30>
		<div style="border:#ddd 2px solid; background:white; width:100%">
		<table width="100%" style="font-size:15px; line-height:22px">
		<tr>
			<td colspan=2><img src="kqyb_page_logo.jpg"><b style="font-size:20px;color:gray">康琪100客户联络中心</b> <hr></td>
		</tr>
		<tr>
			<td width="5%" nowrap>【<b style='color:#cc0000;'>客户电话</b>】:</td><td><input type="text" id="telephone" style="font-size:23px; font-weight:bold; color:#3333ff; width:200px; height:26px; border:#0066cc 1px solid" onkeyup="if(event.keyCode==13){prepare()} else {$('#iframe_td').html('')}"><input type="button" value="确认号码" onclick="prepare()" style='border:gray 1px solid; font-size:15px; font-weight:bold; height:29px; color:#ff9900'> <span id="iframe_td"></span>　　(当前登录工号：<font color=red><?echo $_SESSION['kqyb_agent_id']?></font>)</td>
		</tr>
		<tr>
			<td colspan=2><hr>
			【<b>外呼说明</b>】：<Br>
			<font style="font-size:12px">
			1、先输入电话号码后，直接<font color=green>按“回车”键</font>或<font color=green>点击“确认号码”</font>按钮；外地手机号码前请注意加0；<br>
			2、再点击右边生成的<font color=green>绿色电话图标</font>按钮，将开始外线呼叫；外呼中偶尔有接通延时，请耐心等待；<br>
			</font>
			</td>
		</tr>
		</table>
		</div>
	</td>
	</tr>
	<tr>
	<td>
		<table id="flex1" style="display:none"></table>
	</td>
	</form>
	</tr>
</table>

<script>
	 var agent_id = "<?echo $_SESSION['kqyb_agent_id']?>";
	 var c_group = "kqyb14,kqyb13,kqyb12,kqyb11,kqyb10,kqyb09,kqyb08,kqyb07,kqyb16,kqyb17,kqyb18,kqyb19,kqyb20,kqyb01,";
	 var b_group = "kqyb02,kqyb03,kqyb04,kqyb05,kqyb06,kqyb15,kqyb21,kqyb22,kqyb23,kqyb24,kqyb25,";

     function get_group_caller() {
		if(c_group.indexOf(agent_id+",") >= 0) {
			return "22501313"
		} else if(b_group.indexOf(agent_id+",") >= 0) {
			return "22502121"
		} 
		return "4008499100";
	 }

	function prepare() {
		var tel = $("#telephone").val();
		if(tel == "") {
			alert("请输入客户电话号码！");
			return; 
		}
		var str = "<iframe src='http://222.240.139.227:9080/agent_event/callout_button.jsp?caller="+get_group_caller()+"&called="+$("#telephone").val()+"&iconSize=30' width=31 height=31 frameborder=0 marginheight=0 marginwidth=0 scrolling=no align=top></iframe>";
		$("#iframe_td").html(str);
	}


	var h = window.screen.height-(115+122+300); // 属于嵌入外部url，只能按screen高度大致计算
	//alert(h)
	if(h < 0) h = 'auto'
	$("#flex1").flexigrid({
		url: 'client_query.php?action=list',
		dataType: 'json',
		colModel : [
			{display: 'ID', name : 'a', width : 30, sortable : false, align: 'center'},
			{display: '客户姓名', name : 'a', width : 130, sortable : false, align: 'center'},
			{display: '性别', name : 'a', width : 60, sortable : false, align: 'center'},
			{display: '联系电话', name : 'b', width : 120, sortable : false, align: 'center'},
			{display: '客户区域', name : 'b', width : 100, sortable : false, align: 'center'},
			{display: '呼叫类型', name : 'c', width : 80, sortable : true, align: 'center'},
			{display: '服务号码', name : 'c', width : 80, sortable : true, align: 'center'},
			{display: '呼叫结果', name : 'c', width : 80, sortable : true, align: 'center'},
			{display: '业务类型', name : 'b', width : 80, sortable : false, align: 'center'},
			{display: '沟通内容', name : 'e', width : 210, sortable : true, align: 'center'},
			{display: '座席工号', name : 'f', width : 80, sortable : true, align: 'center'},
			{display: '记录时间', name : 'f', width : 120, sortable : true, align: 'center'}
			],
		buttons : [
            {name: '新增', bclass: 'add', onpress : add},
			{name: '修改', bclass: 'edit', onpress : edit},
			{name: '删除', bclass: 'del', onpress : del},
			{separator: true},
			{name: '导出数据', bclass: 'other', onpress : export_excel}
		],
		async : true,
		usepager: true,
		title: '客户呼叫历史记录',
		useRp: true,
		rp: 8,
		showTableToggleBtn: false,
		width: 'auto',
		height: h,
		resizable : false,
		singleSelect : true
	});

	<?
	$add_url = "client_panel.php?op=add";
	$edit_url = "client_panel.php?op=edit&id="; 
	$del_url = "client_query.php?action=del&id=";
	$dlg_size = "600,320";
	require("../../grid_common_js.php");
	?>

    $('#flex1').dblclick( function (e) { 
        select_row_on_dblclick(e);
        edit();
    });

	function export_excel() {}

	
	function show_call_panel(telephone, call_tel, call_type) {
		dlg = new Dialog({ title: '当前呼叫客户信息', resizable:false, maximizable:false}).href("call_panel.php?telephone="+telephone+"&call_tel="+call_tel+"&call_type="+call_type+"&agent_id="+agent_id);
		dlg.show().setSize(600, 380).center();	
		$("#iframe_td").html(''); // 每次接通事件响应后，则清除掉外呼按钮，强制重新生成！
	}


</script>
</body>
</html>